<template>
<div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="200px">
      <div class="common-form">{{$t('appsetting.passport_settings')}}</div>
      <el-form-item :label="$t('appsetting.passport_type')">
        <div>
          <el-radio v-model="form.passportType" :label="10"
            >{{$t('appsetting.wechat_open_platform')}}</el-radio
          >
        </div>
        <el-col class="gray"> {{$t('appsetting.passport_note')}} 

<a href="https://open.weixin.qq.com" target="_blank" class="blue"
            >{{$t('appsetting.wechat_open_platform')}}</a
          >
        </el-col>
      </el-form-item>
      <!--提交-->
      <div class="common-button-wrapper">
        <el-button type="primary" @click="onSubmit">{{$t('appsetting.submit')}}</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
import AppSettingApi from "@/api/appsetting.js";
export default {
  data() {
    return {
      form: {
        passportOpen: 0,
        passportType: 10
      }
    };
  },
  created() {
    this.getData();
  },
  methods: {
    /*获取数据*/
    getData() {
      let self = this;
      AppSettingApi.appDetail({}, true).then(res => {
        self.form.passportOpen = res.data.passportOpen;
        self.form.passportType = res.data.passportType;
      }).catch(error => {});
    },
    //提交表单
    onSubmit() {
      let self = this;
      let params = this.form;
      AppSettingApi.editApp(params, true).then(data => {
        ElMessage({
          message: $t("appsetting.setup_success"),
          type: "success"
        });
        self.$router.push("/appsetting/app/index");
      }).catch(error => {});
    },
    //监听复选框选中
    handleCheckedCitiesChange(val) {}
  }
};
</script>

